Skip to content

[ENHANCEMENT] Replace kube-rbac-proxy with controller-runtime built-in metrics auth#372

Draft
slashpai wants to merge 1 commit into
perses:mainfrom
slashpai:replace-kube-rbac-proxy
Draft

[ENHANCEMENT] Replace kube-rbac-proxy with controller-runtime built-in metrics auth#372
slashpai wants to merge 1 commit into
perses:mainfrom
slashpai:replace-kube-rbac-proxy

Conversation

@slashpai
Copy link
Copy Markdown
Member

Description

Replace the kube-rbac-proxy sidecar with controller-runtime's built-in
SecureServing and FilterProvider for metrics endpoint authentication
and authorization, as recommended by Kubebuilder since v3.15.0.

Closes: #341

Type of change

  • FEATURE (non-breaking change which adds functionality)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • BREAKINGCHANGE (fix or feature that would cause existing functionality to not work as expected)
  • DOC (documentation only)
  • IGNORE (tooling, build system, CI, etc.)

Verification

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated
  • Manual testing performed

Checklist

  • Pull request has a descriptive title and context useful to a reviewer
  • Code follows project conventions and passes linting
  • All commits have DCO signoffs

@slashpai slashpai force-pushed the replace-kube-rbac-proxy branch 3 times, most recently from 553504d to 22ac74b Compare March 19, 2026 08:55
@slashpai slashpai marked this pull request as ready for review March 19, 2026 16:05
@slashpai slashpai requested a review from a team as a code owner March 19, 2026 16:05
@slashpai
Copy link
Copy Markdown
Member Author

cc @jgbernalp

@jgbernalp
Copy link
Copy Markdown
Contributor

@slashpai it seems we need to update the branch

@slashpai slashpai force-pushed the replace-kube-rbac-proxy branch 2 times, most recently from 7606111 to 60e0ed5 Compare April 10, 2026 11:17
…n metrics auth

Remove the kube-rbac-proxy sidecar and use controller-runtime's
SecureServing and filters.WithAuthenticationAndAuthorization to serve
the /metrics endpoint with TLS, TokenReview, and SubjectAccessReview
checks directly from the manager.

Unit tests verify buildMetricsServerOptions correctly sets
SecureServing and FilterProvider based on the --metrics-secure flag.
KUTTL e2e test asserts the deployment has no kube-rbac-proxy sidecar,
the manager exposes port 8443 with correct args, and the expected
RBAC resources exist.

Signed-off-by: Jayapriya Pai <janantha@redhat.com>

Fixes perses#341
@slashpai slashpai force-pushed the replace-kube-rbac-proxy branch from 60e0ed5 to 0446e70 Compare April 10, 2026 11:57
Comment thread docs/api.md
| `config` _[Datasource](#datasource)_ | config specifies the Perses datasource configuration | | Required: \{\} <br /> |
| `client` _[Client](#client)_ | client specifies authentication and TLS configuration for the datasource | | Optional: \{\} <br /> |
| `instanceSelector` _[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#labelselector-v1-meta)_ | instanceSelector selects Perses instances where this datasource will be created | | Optional: \{\} <br /> |
| `instanceSelector` _invalid type_ | instanceSelector selects Perses instances where this datasource will be created | | Optional: \{\} <br /> |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fix the actual valid type here?

Comment thread main.go
return
}
c.NextProtos = []string{"http/1.1"}
tlsOpts := []func(*tls.Config){}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the metrics endpoint can be secure now, how do we handle the certificates configuration? should we reuse the serving certs?

@slashpai
Copy link
Copy Markdown
Member Author

I will revisit this for next release, I need to test this little more

@slashpai slashpai marked this pull request as draft April 29, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace kube-rbac-proxy with controller-runtime built-in metrics auth

3 participants